require 'digest/sha1'

class User < ActiveRecord::Base

  def self.authenticate(login, password)
    return nil if login.blank? || password.blank?
    u = find_by_login(login.downcase) # need to get the salt
    if u.crypted_password == Digest::SHA1.hexdigest(password)
      u
    else
      nil
    end
  end


end
